//
//  NSHomeViewController.m
//  Meboo
//
//  Created by kyo on 2024/3/15.
//

#import "NSHomeViewController.h"
#import "NSHomeListCell.h"
#import "KLModelDetailViewController.h"
#import "KLVipViewController.h"
#import "MBModelDataTool.h"
#import "MBWLMTopicModel.h"
#import "NSModelDetailViewController.h"
#import "FIRMessaging.h"
#import "NSHomeNullView.h"
#import "NSMessageView.h"
#import "NSRongYunManager.h"
#import "NSVipPopView.h"
#import "NSMatchViewController.h"
@interface NSHomeViewController ()
<
UICollectionViewDelegate,
UICollectionViewDataSource
>
@property (nonatomic, strong) UIImageView *backImageView;
@property(nonatomic,strong) UILabel *titleLab;
@property(nonatomic,strong) UILabel *subTitleLab;
@property (nonatomic , strong) UICollectionView *collectionView;
@property (nonatomic, strong) NSMessageView *messageBtn;
@property (nonatomic , strong) NSMutableArray *dictArr;
@property (nonatomic , assign) NSInteger clickNum;

@property (nonatomic, strong) NSHomeNullView *homeNullView;
@property (nonatomic, assign) NSInteger preLoadIndex;
//预加载数组
@property (nonatomic, strong) NSMutableArray *imageArr;

@property (nonatomic, assign) CGFloat timerNum;
@property (nonatomic, strong) NSTimer *timer;
//pop
@property (nonatomic, strong) NSVipPopView *vipPopView;
//非会员 是否达到次数,被限制 1:总次数到了 2:like次数到了
@property (nonatomic , assign) NSInteger LimitType;
@end
@implementation NSHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //程序入口的标识符赋值, 决定着后续子业务的区别
    MBUserAccount *account = [MBUserAccount defaultAccount];
    account.isNewHome = 2;
    [MBUserAccount saveAccount:account];
    
    self.view.backgroundColor = HEXS(@"ffffff");
    self.navigationController.navigationBarHidden = YES;
    [self setupUI];
    [self getdata];
    [MBNotificationCenter addObserver:self selector:@selector(likeOrPass:) name:HOME_MODELDETAIL_LIKEPASS object:nil];
    [MBNotificationCenter addObserver:self selector:@selector(paySuccess) name:PAY_SUCCESS_NOTIFICATION object:nil];
    [[NSRongYunManager sharedManager] getRongCloudToken];
    
    [[FIRMessaging messaging] tokenWithCompletion:^(NSString *token, NSError *error) {
      if (error != nil) {
        NSLog(@"Error getting FCM registration token: %@", error);
      } else {
        NSLog(@"FCM registration token: %@", token);
//        self.fcmRegTokenMessage.text = token;
          //debugTest
//          UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
//          pasteboard.string = token;
      }
    }];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self performSelector:@selector(showLikeAnimation) withObject:nil afterDelay:1.0];
}

#pragma mark - Private Method

- (void)getdata {
    __WeakSelf
    [[MBWhoLikeMeDataManager sharedManager] getHomePageList:^(BOOL success) {
        if (success) {
            if ([MBWhoLikeMeDataManager sharedManager].homeNullState == 1) {
                weakSelf.collectionView.hidden = YES;
                weakSelf.homeNullView.hidden = NO;
                weakSelf.homeNullView.refreshTime = [MBWhoLikeMeDataManager sharedManager].refreshTime;
            } else {
                if ([MBWhoLikeMeDataManager sharedManager].topicDataArr.count > 0) {
                    [weakSelf.collectionView reloadData];
                    weakSelf.collectionView.hidden = NO;
                    weakSelf.homeNullView.hidden = YES;
                    [weakSelf preLoadImage];
                } else {
                    weakSelf.collectionView.hidden = YES;
                    weakSelf.homeNullView.hidden = NO;
                    weakSelf.homeNullView.refreshTime = [MBWhoLikeMeDataManager sharedManager].refreshTime;
                }
            }
        } else {
            weakSelf.collectionView.hidden = YES;
            weakSelf.homeNullView.hidden = NO;
            weakSelf.homeNullView.refreshTime = [MBWhoLikeMeDataManager sharedManager].refreshTime;
        }
    }];
}

- (void)paySuccess {
    [self getdata];
}

-(void)likeOrPass:(NSNotification *)noti{
    if ([noti.object isEqualToString:@"3"]) {
        [[MBWhoLikeMeDataManager sharedManager].topicDataArr removeObjectAtIndex:self.clickNum];
        if ([MBWhoLikeMeDataManager sharedManager].topicDataArr.count == 0) {
            [self getdata];
        } else {
            [self.collectionView reloadData];
        }
        return;
    }
    
    //非会员处理 点击次数问题
    MBUserAccount *account = [MBUserAccount defaultAccount];
    if (![MBUserAccount defaultAccount].isVip && [noti.object isEqualToString:@"1"]) {
        if (account.likeNum < [MBWhoLikeMeDataManager sharedManager].homeLikeNum) {
            //浏览数未达限制
            account.likeNum ++;
            [MBUserAccount saveAccount:account];
        } else {
            //浏览数达到限制 弹窗 响应block事件
            self.LimitType = 2;
            self.vipPopView.index = 0;
            [kKeyWindow addSubview:self.vipPopView];
            self.vipPopView.hidden = NO;
            return;
        }
    }
    
    
    NSInteger likeType = 1;
    if ([noti.object isEqualToString:@"1"]) {
        likeType = 1;
    } else {
        likeType = 4;
    }
    MBWLMTopicModel *model = [MBWhoLikeMeDataManager sharedManager].topicDataArr[self.clickNum];
    
    //debugTest
    //测试的时候临时注释 因为划了就没了
    //        __WeakSelf
    [[MBWhoLikeMeDataManager sharedManager] topicLikeType:likeType userId:model.friendUserCode success:^(BOOL success) {
        if (success) {
            //match
            NSMatchViewController *matchVc = [NSMatchViewController new];
            matchVc.model = model;
            [self.navigationController pushViewController:matchVc animated:YES];
        }
    }];
    
    [[MBWhoLikeMeDataManager sharedManager].topicDataArr removeObjectAtIndex:self.clickNum];
    if ([MBWhoLikeMeDataManager sharedManager].topicDataArr.count == 0) {
        [self getdata];
    } else {
        [self.collectionView reloadData];
    }
}

- (void)preLoadImage {
    [self.imageArr removeAllObjects];
    //预加载图片 一次最多5组model数据
    if ([MBWhoLikeMeDataManager sharedManager].topicDataArr.count <= self.preLoadIndex) {
        return;
    }
    NSInteger endNum = self.preLoadIndex + 5;
    if (endNum >= [MBWhoLikeMeDataManager sharedManager].topicDataArr.count) {
        endNum = [MBWhoLikeMeDataManager sharedManager].topicDataArr.count;
    }
    for (NSInteger i = self.preLoadIndex; i < endNum; i++) {
        MBWLMTopicModel *model = [MBWhoLikeMeDataManager sharedManager].topicDataArr[i];
        for (MBWLMTopicImageModel *imageModel in model.images) {
            [self.imageArr addObject:imageModel.imageUrl];
        }
    }
    self.preLoadIndex = endNum;
    
    __WeakSelf
    // 批量预加载图片
    [[SDWebImagePrefetcher sharedImagePrefetcher] prefetchURLs:self.imageArr
                                                      progress:^(NSUInteger noOfFinishedUrls, NSUInteger noOfTotalUrls) {
        // 预加载进度回调
    }
                                                     completed:^(NSUInteger noOfFinishedUrls, NSUInteger noOfSkippedUrls) {
        // 预加载完成回调
        [weakSelf preLoadImage];
    }];
}

//show likeAnimation in center
- (void)showLikeAnimation {
    NSHomeListCell *Cell;
    CGFloat distance = 10000.0;
    CGFloat ceny = self.collectionView.frame.origin.y+self.collectionView.frame.size.height/2;
    for (NSHomeListCell *centerCell in self.collectionView.visibleCells) {
        //cell在当前collection的位置
        CGRect cellRect = [self.collectionView convertRect:centerCell.frame toView:self.collectionView];
        //cell在当前屏幕的位置
        CGRect rect = [self.collectionView convertRect:cellRect toView:self.view];
        CGFloat cellCenter = rect.origin.y+rect.size.height/2;
        if (fabs(cellCenter-ceny)<distance) {
            distance = fabs(cellCenter-ceny);
            Cell = centerCell;
        }
    }
    if (Cell.tag == 2 && ![MBUserAccount defaultAccount].isShowFC) {
        MBUserAccount *account = [MBUserAccount defaultAccount];
        account.isShowFC = YES;
        [MBUserAccount saveAccount:account];
        Cell.fcAnimation = YES;
    }
    Cell.likeAnimation = YES;
}
//stop likeAnimation in center
- (void)stopLikeAnimation {
    for (NSHomeListCell *centerCell in self.collectionView.visibleCells) {
        centerCell.likeAnimation = NO;
    }
}

#pragma mark - Action
- (void)likeAction:(NSIndexPath *)indexPath {
    MBWLMTopicModel *model = [MBWhoLikeMeDataManager sharedManager].topicDataArr[indexPath.row];
//    //debugTest
    //测试的时候临时注释 因为划了就没了
    [[MBWhoLikeMeDataManager sharedManager] topicLikeType:1 userId:model.userCodeFriend ?: model.friendUserCode success:^(BOOL success) {
        if (success) {
            //match
            NSMatchViewController *matchVc = [NSMatchViewController new];
            matchVc.model = model;
            [self.navigationController pushViewController:matchVc animated:YES];
        }
    }];
    
    //调用此方法作用->假如第三个cell的提示已出现,这里将它隐藏,否测第三个cell发生变化,会出现异常
    if ([MBUserAccount defaultAccount].isShowFC) {
        [self stopLikeAnimation];
    }
    
    CGFloat height = ScreenHeight -(ScreenHeight - TabbarHeight-StatusBarAndNavigationBarHeight-MBHeightScale(20))/2;
    NSHomeListCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath];
    
    //cell在当前collection的位置
    CGRect cellRect = [self.collectionView convertRect:cell.frame toView:self.collectionView];
    //cell在当前屏幕的位置
    CGRect rect = [self.collectionView convertRect:cellRect toView:self.view];
    
    
    
    cell.frame = rect;
    
    UIView *view = self.view;
    UIImageView *imageView = [self convertViewToImage:cell];
    CGPoint startPoint = CGPointMake(ScreenWidth/2, cell.frame.origin.y+cell.frame.size.height/2);
    
    
    CGPoint endPoint = CGPointMake(-225, height);
    
    
    [self showAddCartAnmationSview:view imageView:imageView starPoin:startPoint endPoint:endPoint dismissTime:0.5 index:indexPath.row];
//    if ([MBWhoLikeMeDataManager sharedManager].topicDataArr.count <= 1) {
//        [self getdata];
//    } else {
        [self.collectionView performBatchUpdates:^{

        [[MBWhoLikeMeDataManager sharedManager].topicDataArr removeObjectAtIndex:indexPath.row];

        [self.collectionView deleteItemsAtIndexPaths:@[indexPath]];

        }completion:^(BOOL finished){
            if ([MBWhoLikeMeDataManager sharedManager].topicDataArr.count == 0) {
                [self getdata];
            } else {
                [self.collectionView reloadData];
            }


        }];
//    }
}

#pragma mark -- like消失动效
- (void)showAddCartAnmationSview:(UIView *)sview
                       imageView:(UIView *)imageView
                        starPoin:(CGPoint)startPoint
                        endPoint:(CGPoint)endpoint
                     dismissTime:(float)dismissTime
                     index:(NSInteger)index
{
    __block CALayer *layer;
    layer                               = [[CALayer alloc]init];
    layer.contents                      = imageView.layer.contents;
    layer.frame                         = imageView.frame;
    layer.opacity                       = 1;
    [sview.layer addSublayer:layer];
    UIBezierPath *path                  = [UIBezierPath bezierPath];
    [path moveToPoint:startPoint];
    [path addQuadCurveToPoint:endpoint controlPoint:startPoint];
    //设置位置动画
    CAKeyframeAnimation *animation=[CAKeyframeAnimation animationWithKeyPath:@"position"];
    animation.path                      = path.CGPath;
    animation.removedOnCompletion       = NO;
    //设置大小动画
    CGSize finalSize                    = CGSizeMake(imageView.bounds.size.height, imageView.bounds.size.width);
    CABasicAnimation *resizeAnimation   = [CABasicAnimation animationWithKeyPath:@"bounds.size"];
    resizeAnimation.removedOnCompletion = NO;
    [resizeAnimation setToValue:[NSValue valueWithCGSize:finalSize]];
    //旋转
    CABasicAnimation* rotationAnimation;
    rotationAnimation                   = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    rotationAnimation.toValue           = [NSNumber numberWithFloat: M_PI * 2.0 ];
    rotationAnimation.cumulative        = YES;
    rotationAnimation.duration          = 300000;
    rotationAnimation.repeatCount       = 1000;
    //动画组
    CAAnimationGroup * animationGroup   = [[CAAnimationGroup alloc] init];
//    animationGroup.animations           = @[animation,resizeAnimation,rotationAnimation];
    animationGroup.animations           = @[animation];
    animationGroup.duration             = dismissTime;
    animationGroup.removedOnCompletion  = NO;
    animationGroup.fillMode             = kCAFillModeForwards;
    animationGroup.autoreverses         = NO;
    animationGroup.timingFunction       = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
    [layer addAnimation:animationGroup forKey:@"buy"];
    
    __WeakSelf
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(dismissTime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [layer removeFromSuperlayer];
        layer = nil;

//        [weakSelf.collectionView reloadData];
    });
}

//view转图片
- (UIImageView*)convertViewToImage:(UIView*)view {
    CGSize s = view.bounds.size;
    // 下面方法，第一个参数表示区域大小。第二个参数表示是否是非透明的。如果需要显示半透明效果，需要传NO，否则传YES。第三个参数就是屏幕密度了
    UIGraphicsBeginImageContextWithOptions(s, NO, [UIScreen mainScreen].scale);
    [view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage*image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    
    UIImageView *imageView = [UIImageView new];
    imageView.frame = view.frame;
    imageView.image = image;
    return imageView;
}

#pragma mark -- scrollview delegate
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
    [self performSelector:@selector(showLikeAnimation) withObject:nil afterDelay:1.0];
}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
    [self stopLikeAnimation];
}

- (void)selectorType {
//    self.timer = [MSWeakTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(timerTest) userInfo:nil repeats:YES dispatchQueue:dispatch_get_main_queue()];

    // NSDefaultRunLoopMode模式，切换RunLoop模式，定时器停止工作.
    // [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
    
    // UITrackingRunLoopMode模式，切换RunLoop模式，定时器停止工作.
    // [[NSRunLoop currentRunLoop] addTimer:timer forMode:UITrackingRunLoopMode];
    
    // common modes的模式,以下三种模式的组合模式 NSDefaultRunLoopMode & NSModalPanelRunLoopMode & NSEventTrackingRunLoopMode
//    [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
}
- (void)timerTest {
    self.timerNum += 0.1;
}

#pragma mark -- collectionView  delegate datasource
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
    [self.dictArr removeAllObjects];
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return [MBWhoLikeMeDataManager sharedManager].topicDataArr.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    NSHomeListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"NSHomeListCell" forIndexPath:indexPath];
    cell.tag = indexPath.row;
    cell.model = [MBWhoLikeMeDataManager sharedManager].topicDataArr[indexPath.row];
    cell.tagStr = [[MBModelDataTool sharedTool] getTagString];
    cell.dict = [[MBModelDataTool sharedTool] getDictData];
    __WeakSelf
    cell.likeBlock = ^(BOOL popVip) {
        if (popVip) {
            //浏览数达到限制 弹窗 响应block事件
            weakSelf.LimitType = 2;
            weakSelf.vipPopView.index = 0;
            [kKeyWindow addSubview:weakSelf.vipPopView];
            weakSelf.vipPopView.hidden = NO;
        } else {
            [weakSelf likeAction:indexPath];
        }
    };
    [self.dictArr addObject:cell.dict];
    return cell;
}

//设置每个section的UIEdgeInsets
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
    return UIEdgeInsetsMake(MBHeightScale(10), MBWidthScale(0), MBHeightScale(10), MBWidthScale(0));
}

//设置列间距
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
    return MBHeightScale(15);
}

//设置每个item水平间距
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
    return MBWidthScale(0);
}

//定义每一个cell的大小
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    return CGSizeMake(ScreenWidth-MBWidthScale(40), MBHeightScale(270));
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    self.clickNum = indexPath.row;
    NSModelDetailViewController *vc = [NSModelDetailViewController new];
    MBWLMTopicModel *model = [MBWhoLikeMeDataManager sharedManager].topicDataArr[indexPath.row];
    vc.modelStyle = HomeModelDetail;
    vc.userId = model.userCodeFriend ?: model.friendUserCode;
    [self.navigationController pushViewController:vc animated:YES];
    /**
     埋点
     点击整个卡片区域，进入他人主页 Home_Profile
     */
    [[NSIOApiManager sharedManager] setIOWithEventName:@"Home_Profile"];
}

#pragma mark - UI
- (void)setupUI {
    
    [self.view addSubview:self.backImageView];
    [self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
    
    [self.view addSubview:self.messageBtn];
    [self.messageBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(StatusBarHeight+6);
        make.right.mas_equalTo(MBWidthScale(-20));
        make.width.height.mas_equalTo(MBHeightScale(36));
    }];
    
    [self.view addSubview:self.titleLab];
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.messageBtn).offset(MBHeightScale(4));
        make.left.mas_equalTo(MBWidthScale(24));
    }];
    
    [self.view addSubview:self.subTitleLab];
    [self.subTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLab.mas_bottom).offset(MBHeightScale(10));
        make.left.mas_equalTo(MBWidthScale(24));
    }];
    
    
    [self.view addSubview:self.collectionView];
    [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.subTitleLab.mas_bottom).offset(MBHeightScale(10));
        make.left.right.bottom.equalTo(self.view);
    }];
    
    [self.view addSubview:self.homeNullView];
    [self.homeNullView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self.view);
        make.top.equalTo(self.subTitleLab.mas_bottom);
    }];
    
    //pop
    [self vipPopView];
}

#pragma mark - Setter && Getter
- (UILabel *)titleLab {
    if (!_titleLab) {
        _titleLab = [UILabel new];
        _titleLab.text = @"Meboo";
        _titleLab.font = PDBoldScale(30);
        _titleLab.textColor = HEXS(@"B92176");
    }
    return _titleLab;
}

- (UILabel *)subTitleLab {
    if (!_subTitleLab) {
        _subTitleLab = [UILabel new];
        _subTitleLab.numberOfLines = 0;
        _subTitleLab.text = @"Continuously searching for a sweetheart girl for you";
        _subTitleLab.font = MBHelFontSizeScale(14);
        _subTitleLab.textColor = HEXS(@"999999");
    }
    return _subTitleLab;
}

- (UICollectionView *)collectionView {
    if (!_collectionView) {
        UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
        flowLayout.minimumInteritemSpacing = 0;
        flowLayout.minimumLineSpacing = 0;
        _collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:flowLayout];
        _collectionView.backgroundColor = UIColor.clearColor;
        _collectionView.delegate = self;
        _collectionView.dataSource = self;
        _collectionView.showsVerticalScrollIndicator = NO;
        _collectionView.showsHorizontalScrollIndicator = NO;
        [_collectionView registerClass:[NSHomeListCell class] forCellWithReuseIdentifier:@"NSHomeListCell"];
    }
    return _collectionView;
}

- (NSMessageView *)messageBtn {
    if (!_messageBtn) {
        _messageBtn = [[NSMessageView alloc] init];
    }
    return _messageBtn;
}

- (UIImageView *)backImageView {
    if (!_backImageView) {
        _backImageView = [UIImageView new];
        _backImageView.image = ImageWithName(@"home_back_image");
    }
    return _backImageView;
}

- (NSMutableArray *)dictArr {
    if (!_dictArr) {
        _dictArr = [NSMutableArray array];
    }
    return _dictArr;
}

- (NSHomeNullView *)homeNullView {
    if (!_homeNullView) {
        __WeakSelf
        _homeNullView = [NSHomeNullView new];
        _homeNullView.hidden = YES;
        _homeNullView.popBlock = ^(BOOL isTimeOver) {
            if (!isTimeOver) {
                weakSelf.LimitType = 1;
                [kKeyWindow addSubview:weakSelf.vipPopView];
                weakSelf.vipPopView.hidden = NO;
                /**
                 埋点
                 首页 浏览用户达上限拉起会员订阅 Home_View_Sub
                 */
                [[NSIOApiManager sharedManager] setIOWithEventName:@"Home_View_Sub"];
            } else {
                [weakSelf getdata];
            }
        };
        _homeNullView.refreshBlock = ^{
            [weakSelf getdata];
        };
    }
    return _homeNullView;
}

//预加载时,临时存储数组
- (NSMutableArray *)imageArr {
    if (!_imageArr) {
        _imageArr = [NSMutableArray array];
    }
    return _imageArr;
}

- (NSVipPopView *)vipPopView {
    if (!_vipPopView) {
        __WeakSelf
        _vipPopView = [[NSVipPopView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
        _vipPopView.payBlock = ^{
            [weakSelf getdata];
            /**
             埋点
             首页 浏览用户达浏览上限拉起会员订阅支付成功 Home_View_Subsuccess
             首页 喜欢用户达上限拉起会员订阅支付成功 Home_Like_Subsuccess
             */
            [[NSIOApiManager sharedManager] setIOWithEventName:self.LimitType == 1 ? @"Home_View_Subsuccess" : @"Home_Like_Subsuccess"];
        };
    }
    return _vipPopView;
}
@end
